import { createApp } from 'vue'
import App from './App.vue'
import router from './router/index'
import 'element-plus/theme-chalk/el-loading.css';
import 'element-plus/theme-chalk/el-message.css';
import pinia from "@/store/store"
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import dayjs from "dayjs"
import locale from 'element-plus/lib/locale/lang/zh-cn'
import {ElementPlus} from "@element-plus/icons-vue";

const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

app.use(pinia).use(router).use(ElementPlus, { locale }).mount('#app')
app.config.globalProperties.$dayjs = dayjs; //全局使用dayjs

app.directive('onceClick',{
    mounted(el, binding) {
        el.addEventListener('click', () => {
            if (!el.disabled) {
                el.disabled = true;
                setTimeout(() => {
                    el.disabled = false;
                }, binding.value || 1000);
            }
        });
    }
})





